microsoft_seriesfandomcom-20200215-history
Server Message Block
In computer networking, Server Message Block (SMB, also known as Common Internet File System, CIFS) operates as an application-layer network protocol mainly used to provide shared access to files, printers, serial ports, and miscellaneous communications between nodes on a network. It also provides an authenticated inter-process communication mechanism. Most usage of SMB involves computers running Microsoft Windows, where it is often known as "Microsoft Windows Network". When discussing SMB, one should distinguish: * the SMB protocol specification * the "server" and "workstation" services that implement the protocol on Windows * the Samba service that implements the protocol on Unix systems * NetBIOS transport used by SMB on legacy versions of Windows * the DCE/RPC services that use SMB as an authenticated inter-process communication channel (over named pipes) * the "Network Neighborhood" protocols which primarily (but not exclusively) run as datagram services directly on the NetBIOS transport History Barry Feigenbaum originally designed SMB at IBM with the aim of turning DOS "Interrupt 33" (21h) local file-access into a networked file-system. Microsoft has made considerable modifications to the version used most commonly. Microsoft merged the SMB protocol with the LAN Manager product which it had started developing for OS/2 with 3Com circa 1990, and continued to add features to the protocol in Windows for Workgroups (circa 1992) and in later versions of Windows. SMB was originally designed to run on top of the NetBIOS/NetBEUI API (typically implemented with NBF, NetBIOS over IPX/SPX, or NBT). Since Windows 2000, SMB runs by default directly on top of TCP — a feature known as "direct host SMB" where the server service listens on TCP port 445. At around the time when Sun Microsystems announced WebNFS YANFS yet another nfs, Microsoft launched an initiative in 1996 to rename SMB to Common Internet File System (CIFS) ( ), and added more features, including support for symbolic links, hard links, larger file sizes, and an initial attempt at supporting direct connections over TCP port 445 without all the NetBIOS trimmings (a largely experimental effort that required further refinement). Microsoft submitted some partial specifications as Internet-Drafts to the IETF,* Common Internet File System Protocol (CIFS/1.0) * CIFS Logon and Pass Through Authentication * CIFS/E Browser Protocol * CIFS Printing Specification * CIFS Remote Administration Protocol * A Common Internet File System (CIFS/1.0) Protocol though these submissions have expired. Because of the importance of the SMB protocol in interacting with the widespread Microsoft Windows platform, coupled with the heavily modified nature of the SMB implementation present in that platform, the Samba project originated with the aim of reverse engineering and providing a free implementation of a compatible SMB client and server for use with non-Microsoft operating systems. Microsoft introduced SMB2 with Windows Vista in 2006. Implementation Client-server approach SMB works through a client-server approach, where a client makes specific requests and the server responds accordingly. One section of the SMB protocol specifically deals with access to filesystems, such that clients may make requests to a file server; but some other sections of the SMB protocol specialize in inter-process communication (IPC). The Inter-Process Communication (IPC) share or ipc$ is a network share on computers running Microsoft Windows. This virtual share is used to facilitate communication between processes and computers over SMB, often to exchange data between computers that have been authenticated. Developers have optimized the SMB protocol for local subnet usage, but users have also put SMB to work to access different subnets across the Internet — exploits involving file-sharing or print-sharing in MS Windows environments usually focus on such usage. SMB (Server Message Block) servers make their file systems and other resources available to clients on the network. Client computers may want access to the shared file systems and printers on the server, and in this primary functionality SMB has become best-known and most heavily used. However, the SMB file-server aspect would count for little without the NT domains suite of protocols, which provide NT-style domain-based authentication at the very least. Almost all implementations of SMB servers use NT Domain authentication to validate user-access to resources. Performance issues NetBIOS The use of the SMB protocol has often correlated with a significant increase in broadcast traffic on a network. However the SMB itself does not use broadcasts—the broadcast problems commonly associated with SMB actually originate with the NetBIOS service location protocol. By default, a Microsoft Windows NT 4.0 server used NetBIOS to advertise and locate services. NetBIOS functions by broadcasting services available on a particular host at regular intervals. While this usually makes for an acceptable default in a network with a smaller number hosts, increased broadcast traffic can cause problems on an unswitched network as the number of hosts increases. The implementation of name resolution infrastructure in the form of Windows Internet Naming Service (WINS) or Domain Name System (DNS) resolves this problem. WINS was a proprietary implementation used with Windows NT 4.0 networks, but brought about its own issues and complexities in the design and maintenance of a Microsoft network. Since the release of Windows 2000, the use of WINS for name resolution has been deprecated by Microsoft, with Dynamic DNS now configured as the default name resolution protocol for all Windows operating systems. Resolution of (short) NETBIOS names by DNS requires that DNS "guess" the fully qualified name, usually using a connection-specific DNS Suffix. WINS can still be configured as a secondary name resolution protocol for interoperability with legacy Windows environments and applications. Further, Microsoft DNS servers can forward name resolution requests to legacy WINS servers in order to support name resolution integration with legacy (pre-Windows 2000) environments that do not support DNS. WAN performance Network designers have found that latency has a significant impact on the performance of the SMB 1.0 protocol, that it performs more poorly than other protocols like FTP. Monitoring reveals a high degree of "chattiness" and a disregard of network latency between hosts. For example, a VPN connection over the Internet will often introduce network latency. Microsoft has explained that performance issues come about primarily because SMB 1.0 is a block-level rather than a streaming protocol, that was originally designed for small LANs; it has a block size that is limited to 64K, SMB signing creates an additional overhead and the TCP window size is not optimized for WAN links. Solutions to this problem include the updated SMB 2.0 protocol, Offline Files, TCP window scaling and WAN acceleration devices from various network vendors that cache and optimize SMB 1.0 . Microsoft's modifications Microsoft added several extensions to its own SMB implementation. For example, it added NTLM Version 2 authentication because LanMan authentication and NTLM version 1 (derived from the original legacy SMB specification's requirement to use IBM "LanManager" passwords) implemented DES in a flawed manner that allowed passwords to be cracked. Later, Kerberos authentication was also added. The NT 4.0 Domain Logon protocols initially used 40-bit encryption outside of the United States of America, because of export restrictions on 128-bit encryption (subsequently lifted in 1996 when President Bill Clinton signed Executive order 13026 ). Opportunistic locking support has changed with each server release. Opportunistic locking In the SMB protocol, opportunistic locking is a file locking mechanism designed to improve performance by controlling caching of files on the client. Contrary to the traditional locks, OpLocks are not used in order to provide mutual exclusion. The main goal of OpLocks is to provide synchronization for caching. There are 3 types of opportunistic locks: Batch Locks Batch OpLocks were created originally to support a particular behavior of MS-DOS batch file execution operation in which the file is opened and closed many times in a short period. This is an obvious performance problem. To solve this, a client may ask for a OpLock of type "batch". In this case, the client delays sending the close request and if a subsequent open request is given, the two requests cancel each other. Exclusive Locks When an application opens in "shared mode" a file hosted on an SMB server which is not opened by any other process (or other clients) the client receives an exclusive OpLock from the server. This means that the client may now assume that it is the only process with access to this particular file, and the client may now cache all changes to the file before committing it to the server. This is an obvious performance boost, since fewer round-trips are required in order to read and write to the file. If another client/process tries to open the same file, the server sends a message to the client (called a break or revocation) which invalidates the exclusive lock previously given to the client. The client then flushes all changes to the file. Level 2 OpLocks If an exclusive OpLock is held by a client and a locked file is opened by a third party, the client has to relinquish its exclusive OpLock to allow the other client's write/read access. A client may then receive a "Level 2 OpLock" from the server. A Level 2 OpLock allows the caching of read requests but excludes write caching. Breaks In contrast with the SMB protocol's "standard" behavior, a break request may be sent from server to client. It informs the client that an OpLock is no longer valid. This happens, for example, when another client wishes to open a file in a way that invalidates the OpLock. The first client is then sent an OpLock break and required to send all its local changes (in case of batch or exclusive OpLocks), if any, and acknowledge the OpLock break. Upon this acknowledgment the server can reply to the second client in a consistent manner. SMB2 Microsoft introduced a new version of the Server Message Block (SMB) protocol (SMB 2.0 or SMB2) with Windows Vista in 2006. Although the protocol is proprietary, its specification has been published to allow other systems to interoperate with Microsoft operating systems that use the new protocol. SMB2 reduces the 'chattiness' of the protocol by reducing the number of commands and subcommands from over a hundred to just nineteen. It has mechanisms for pipelining, that is, sending additional requests before the response to a previous request arrives. It adds the ability to compound multiple actions into a single request, which significantly reduces the number of round-trips the client needs to make to the server, improving performance as a result. SMB1 also has a compounding mechanism — known as AndX — to compound multiple actions, but Microsoft clients rarely use AndX. SMB2 supports larger buffer-sizes, which can provide better performance with large file-transfers and better use of faster networks. It also introduces the notion of "durable file handles": these allow a connection to an SMB server to survive brief network-outages, such as may occur in a wireless network, without having to incur the overhead of negotiating a new session. SMB2 includes support for symbolic links. Other improvements include caching of file properties, improved message signing with HMAC SHA-256 hashing algorithm and better scalability by increasing the number of users, shares and open files per server among others. The SMB1 protocol uses 16-bit data sizes, which amongst other things, limits the maximum block size to 64K. SMB2 uses 32 or 64-bit wide storage fields, and 128 bits in the case of file-handles, thereby removing previous constraints on data sizes. Windows Vista and later operating systems use SMB2 when communicating with other machines running Windows Vista or later. SMB1 continues in use for connections with older versions of Windows, as well as systems like Samba and various vendors' NAS solutions. Samba 4 also includes experimental support for SMB2. SMB2 brings two substantial benefits to Microsoft: # clearer intellectual-property ownership. SMB1, originally designed by IBM, became part of a wide variety of non-Windows operating systems such as Xenix, OS/2 and VMS (Pathworks). X/Open standardised it partially; it also had draft IETF standards which lapsed. (See http://ubiqx.org/cifs/Intro.html for historical detail). # a relatively clean break with the past. Microsoft's SMB1 code has to work with a huge variety of SMB clients and servers. A large number of items in the protocol remain optional (such as short and long filenames). SMB1 features many levels of information for commands (selecting what structure to return for a particular request). SMB1 added Unicode at a later date. SMB2 involves significantly reduced compatibility-testing for Microsoft ( involving only other Windows Vista clients and servers). SMB2 code has considerably less complexity since far less variability exists (for example, non-Unicode code paths become redundant as SMB2 requires Unicode support). SMB 2.1 SMB 2.1, introduced with Windows 7 and Server 2008 R2, introduced further performance enhancements with a new opportunistic locking mechanism. Points of interest The SMB "Inter-Process Communication" (IPC) system provides named pipes and was one of the first inter-process mechanisms commonly available to programmers that provides a means for services to inherit the authentication carried out when a client first connected to an SMB server. Some services that operate over named pipes, such as those which use Microsoft's own implementation of DCE/RPC over SMB, known as MSRPC over SMB, also allow MSRPC client programs to perform authentication, which over-rides the authorization provided by the SMB server, but only in the context of the MSRPC client program that successfully makes the additional authentication. Since Windows domain controllers use SMB to transmit policies at login, they have packet-signing enabled by default to prevent man-in-the-middle attacks; the feature can also be turned on for any server running Windows NT 4.0 Service Pack 3 or later. The design of Server Message Block version 2 (SMB2) aims to mitigate this performance-limitation by coalescing SMB signals into single packets. As another point of interest, SMB supports opportunistic locking — a special type of locking-mechanism — on files in order to improve performance. SMB serves as the basis for Microsoft's Distributed File System implementation. Over the years, there have been many security vulnerabilities in Microsoft's implementation of the protocol or components that it directly relies on, with the most recent vulnerability involving the SMB2 implementation. Specifications for SMB and SMB2 Protocols The specifications for the SMB and SMB2 procotols are available for free download from Microsoft's MSDN Open Protocol Site * Open Specifications Developer Center http://msdn.microsoft.com/en-us/library/cc216517%28PROT.10%29.aspx There are a number of specifications that are relevant to the SMB protocol: *MS-CIFS http://msdn.microsoft.com/en-us/library/ee442092%28PROT.10%29.aspx MS-CIFS is a recent replacement (2007) for the draft-leach-cifs-v1-spec-02.txt a document widely used to implement SMB clients, but also known to have errors of omission and commission *MS-SMB http://msdn.microsoft.com/en-us/library/cc246231%28PROT.10%29.aspx Specification for Microsoft Extensions to MS-CIFS *MS-SMB2 http://msdn.microsoft.com/en-us/library/cc246482%28PROT.10%29.aspx Specification for the SMB 2 protocol *MS-FSSO http://msdn.microsoft.com/en-us/library/ee392367%28PROT.10%29.aspx Describes the intended functionality of the Windows File Access Services System, how it interacts with systems and applications that need file services, and how it interacts with administrative clients to configure and manage the system. Versions and implementations The list below explicitly refers to "SMB" as including an SMB client or an SMB server, plus the various protocols that extend SMB, such as the Network Neighborhood suite of protocols and the NT Domains suite. For simplicity and conciseness and vagueness, however, the list omits mention of the extent or completeness of the reimplementation or porting status for any of these implementations, "lumping" them all together simply as "SMB". * agorum core, open source enterprise content management system with fully integrated CIFS-Server for accessing documents. * Samba, which re-implements the SMB protocol and the Microsoft extensions to it as free software, includes an SMB server and a command-line SMB client. Version 3.0 or later is required for NTLMv2 authentication support, while version 4.0 or later is required for SMB2 interoperability. * Samba TNG: a fork of Samba. * The Linux kernel includes two SMB client implementations that use the Linux VFS, providing access to files on an SMB server through the standard file system API: smbfs and cifs. Also it is possible to mount the whole hierarchy of workgroups/servers/shares ("neighborhood") through fuse kernel module and its userspace counterpart fusesmb. *ONStor Inc. offers an SMB implementation that also supports NFS protocol so users can access the same data through both protocols. *Novell NetWare version 6 and newer has a CIFS server implementation providing access to NetWare volumes for Microsoft Network clients. * FreeBSD includes an SMB client implementation called smbfs that uses its VFS. * NetBSD and Mac OS X include SMB client implementations called smbfs, originally derived from the FreeBSD smbfs; they use the NetBSD and OS X VFS. * Solaris has a project called CIFS client for Solaris, based on the Mac OS X smbfs. * OpenSolaris added in-kernel CIFS server support in October 2007. * Sun Microsystems Cascade, which became known as PC-Netlink, represents a port of Advanced Server for Unix. Sun took over two years making the code useful, due to the poor quality of the original port. * FreeNAS, a dedicated small-sized NAS server, runs FreeBSD for Network-attached storage (NAS) services, and supports protocols including CIFS/Samba * Advanced Server for Unix (AS/U) comprises a port of Windows NT 3.51's SMB server code to Unix. Microsoft licensed the code to AT&T, which then licensed it to major Unix vendors. The poor quality of the original port (allegedly carried out by Microsoft itself) has caused any vendor sub-licensing it significant grief. * VERITAS Software has an implementation of SMB. * SCO has a port of Advanced Server for Unix. * SCO also has VisionFS, a Microsoft-independent re-implementation of SMB developed through reference to Samba source code. * EMC has an SMB server with its Celerra platforms * NetApp has an SMB server implementation * Isilon has a cluster storage or scale-out NAS SMB server implementation * Objective Development's Sharity provides an SMB file-system client for Unix. * The Alfresco content-management system includes JLAN, a Java implementation of an SMB server * JCIFS offers an implementation of an SMB client in Java * RTSMB, a CIFS/SMB implementation written in ANSI C. EBS designed RTSMB from scratch, independently of MS or SAMBA design reference, to run in embedded devices. * Visuality Systems NQ CIFS, a CIFS (SMB) server and client solution for embedded devices — ported to many popular real-time operating systems (RTOSs) * Thursby Software Systems offers a commercial implementation of SMB/CIFS for Mac OS. * An iPhone application named Flash Files has an SMB server implementation. * Some Sony-Ericsson mobile phones have an SMB server built in. See also * Administrative share * Shared file access * AppleTalk * File Transfer Protocol (FTP) * Network File System (NFS) * Remote File System (RFS) * WebDAV * Uniform Naming Convention (UNC) References External links * Hertel, Christopher (2003). Implementing CIFS — The Common Internet FileSystem. Prentice Hall. ISBN 0-13-047116-X. (Text licensed under the Open Publication License, v1.0 or later, available from the link above.) *Technical details about SMB/CIFS *Common Internet File System (CIFS) File Access Protocol - Technical details from Microsoft Corporation *the NT LM 0.12 dialect of SMB. In Microsoft Word format *Samba development information *Introduction to the Common Internet File System (CIFS): Leverage the Power of this Popular Network File Sharing Protocol Online introduction to CIFS: Lecture/blog by Ron Fredericks * Zechner, Anton (2007). "Source-code of a free SMB server for small embedded systems" Category:Windows communication and services Category:Network file systems Category:Network protocols Category:Application layer protocols Category:Inter-process communication cs:Server Message Block de:Server Message Block es:Server Message Block eu:Server Message Block fr:Server Message Block ko:서버 메시지 블록 id:Server Message Block it:Server message block he:SMB nl:SMB (netwerkprotocol) ja:Server Message Block pl:SMB pt:Server Message Block ru:SMB fi:Server Message Block sv:Server Message Block uk:Server Message Block zh:伺服器訊息區塊